package com.kantboot.business.water.domain.vo;

import com.kantboot.util.core.jpa.KantbootGenerationType;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 在用户端展示的商品
 */
@Entity
@Getter
@Setter
@Table(name = "bus_water_goods")
@Accessors(chain = true)
@EntityListeners(AuditingEntityListener.class)
@DynamicUpdate
@DynamicInsert
public class BusWaterGoodsVOInClient implements Serializable {
    /**
     * 状态编码：销售中
     */
    public static final String STATUS_CODE_SELLING = "selling";

    /**
     * 状态编码：未上架
     */
    public static final String STATUS_CODE_NOT_ON_SHELF = "notOnShelf";

    /**
     * 状态编码：草稿
     */
    public static final String STATUS_CODE_DRAFT = "draft";

    /**
     * 主键
     */
    @Id
    @GenericGenerator(name = "snowflakeId", strategy = KantbootGenerationType.SNOWFLAKE)
    @GeneratedValue(generator = "snowflakeId")
    @Column(name = "id")
    private Long id;

    /**
     * 商品名称
     */
    @Column(name = "t_name", length = 64)
    private String name;

    /**
     * 商品图片
     */
    @Column(name = "file_id_of_image")
    private Long fileIdOfImage;

    /**
     * 商品描述
     */
    @Column(name = "t_description", length = 64)
    private String description;

    /**
     * 商品规格
     */
    @Column(name = "t_specification", length = 64)
    private String specification;

    /**
     * 售价
     */
    @Column(name = "sale_price")
    private BigDecimal salePrice;

    /**
     * 积分
     * 用来给用户积分，用户可以用积分升级成会员
     */
    @Column(name = "integral")
    private BigDecimal integral;

    /**
     * 是否在普通用户端显示
     */
    @Column(name = "is_show_in_user")
    private Boolean isShowInUser;

    /**
     * 是否在会员端显示
     */
    @Column(name = "is_show_in_vip")
    private Boolean isShowInVip;


    /**
     * 状态编码（驼峰式）
     * 用来表示商品的状态
     * 1、销售中 selling
     * 2、未上架 notOnShelf
     * 3、草稿 draft
     */
    @Column(name = "t_status_code", length = 64)
    private String statusCode;

    /**
     * 创建时间
     */
    @CreatedDate
    @Column(name = "gmt_create")
    private Date gmtCreate;

    /**
     * 修改时间
     */
    @LastModifiedDate
    @Column(name = "gmt_modified")
    private Date gmtModified;

    /**
     * 商品详情图
     */
    @Column(name = "file_ids_of_body_images")
    private String fileIdsOfBodyImages;

    /**
     * 销售量
     */
    @Column(name = "sale_volume")
    private Long saleVolume;

    @Column(name = "is_deleted")
    private Boolean isDeleted;
}
